package hlhj.fhp.checkpoint.module

import android.content.Context
import com.example.mymvp.mvp.BaseModule
import com.lzy.okgo.model.Response
import hlhj.fhp.checkpoint.http.Apis
import hlhj.fhp.checkpoint.http.CustomAction
import hlhj.fhp.checkpoint.http.LoadingAction
import hlhj.fhp.checkpoint.javaBean.CostBean

/**
 * Created by Never Fear   on 2018\11\9 0009.
Never More....
 */
class CostModule:BaseModule {

    var listener:CostResp?=null
    fun getCostDetail(id:Int,page:Int,c:Context){
        Apis.getCostDetail(id,page)
                ?.doOnSubscribe(LoadingAction(c))
                ?.subscribe(object :CustomAction<Response<CostBean>>(c){
                    override fun httpSuccess(t: Response<CostBean>) {
                        listener?.getCostDetailResp(t.body())
                    }
                })
    }


    interface CostResp{
        fun getCostDetailResp(costBean: CostBean)
    }
}